libxc: Various xc_evtchn_* functions must return signed integer type.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 08:21:39 +0000 (09:21 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 08:21:39 +0000 (09:21 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrl.h

index c0f3b9b54c2e6e71267dff5ca9f0e9a2f69e9b44..0992a7bdbb66bcc0abbc1b82c51fe85ad52d9ccc 100644 (file)
@@ -33,9 +33,10 @@ static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size)
 }
 
 
-int xc_evtchn_alloc_unbound(int xc_handle,
-                            uint32_t dom,
-                            uint32_t remote_dom)
+evtchn_port_or_error_t
+xc_evtchn_alloc_unbound(int xc_handle,
+                        uint32_t dom,
+                        uint32_t remote_dom)
 {
     int rc;
     struct evtchn_alloc_unbound arg = {
index 440cb4f0f4b91a81973a5968bdd6f41c2a65e20c..d12cf94c058e3a7e05df7eb11efa8fa230f02e51 100644 (file)
@@ -254,7 +254,8 @@ int xc_evtchn_notify(int xce_handle, evtchn_port_t port)
     return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid)
 {
     struct ioctl_evtchn_bind_unbound_port bind;
 
@@ -263,8 +264,9 @@ evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
     return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
-evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
-    evtchn_port_t remote_port)
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+                           evtchn_port_t remote_port)
 {
     struct ioctl_evtchn_bind_interdomain bind;
 
@@ -274,22 +276,23 @@ evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
     return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
 {
-    struct ioctl_evtchn_unbind unbind;
+    struct ioctl_evtchn_bind_virq bind;
 
-    unbind.port = port;
+    bind.virq = virq;
 
-    return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
+    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
-evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
+int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
 {
-    struct ioctl_evtchn_bind_virq bind;
+    struct ioctl_evtchn_unbind unbind;
 
-    bind.virq = virq;
+    unbind.port = port;
 
-    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+    return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
 static int dorw(int fd, char *data, size_t size, int do_write)
@@ -317,7 +320,8 @@ static int dorw(int fd, char *data, size_t size, int do_write)
     return 0;
 }
 
-evtchn_port_t xc_evtchn_pending(int xce_handle)
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle)
 {
     evtchn_port_t port;
 
index 65008115ead7dd48186d610d55553da771fe810c..a39157028d3755d5b9fab7800d2f6ffa0233811c 100644 (file)
@@ -165,7 +165,8 @@ int xc_evtchn_notify(int xce_handle, evtchn_port_t port)
     return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid)
 {
     struct ioctl_evtchn_bind_unbound_port bind;
 
@@ -174,8 +175,9 @@ evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
     return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
-evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
-    evtchn_port_t remote_port)
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+                           evtchn_port_t remote_port)
 {
     struct ioctl_evtchn_bind_interdomain bind;
 
@@ -185,22 +187,23 @@ evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
     return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
 {
-    struct ioctl_evtchn_unbind unbind;
+    struct ioctl_evtchn_bind_virq bind;
 
-    unbind.port = port;
+    bind.virq = virq;
 
-    return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
+    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
-evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
+int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
 {
-    struct ioctl_evtchn_bind_virq bind;
+    struct ioctl_evtchn_unbind unbind;
 
-    bind.virq = virq;
+    unbind.port = port;
 
-    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+    return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
 static int dorw(int fd, char *data, size_t size, int do_write)
@@ -228,7 +231,8 @@ static int dorw(int fd, char *data, size_t size, int do_write)
     return 0;
 }
 
-evtchn_port_t xc_evtchn_pending(int xce_handle)
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle)
 {
     evtchn_port_t port;
 
index 7d3a7ecc79b32a8c32d1770156049b03d3f12bb8..73ff16c2cf4ffcf0953965a092fdba2ff639c4ba 100644 (file)
@@ -449,6 +449,9 @@ int xc_domain_setdebugging(int xc_handle,
  * EVENT CHANNEL FUNCTIONS
  */
 
+/* A port identifier is guaranteed to fit in 31 bits. */
+typedef int evtchn_port_or_error_t;
+
 /**
  * This function allocates an unbound port.  Ports are named endpoints used for
  * interdomain communication.  This function is most useful in opening a
@@ -463,13 +466,78 @@ int xc_domain_setdebugging(int xc_handle,
  * @parm remote_dom the ID of the domain who will later bind
  * @return allocated port (in @dom) on success, -1 on failure
  */
-int xc_evtchn_alloc_unbound(int xc_handle,
-                            uint32_t dom,
-                            uint32_t remote_dom);
+evtchn_port_or_error_t
+xc_evtchn_alloc_unbound(int xc_handle,
+                        uint32_t dom,
+                        uint32_t remote_dom);
 
 int xc_evtchn_reset(int xc_handle,
                     uint32_t dom);
 
+/*
+ * Return a handle to the event channel driver, or -1 on failure, in which case
+ * errno will be set appropriately.
+ */
+int xc_evtchn_open(void);
+
+/*
+ * Close a handle previously allocated with xc_evtchn_open().
+ */
+int xc_evtchn_close(int xce_handle);
+
+/*
+ * Return an fd that can be select()ed on for further calls to
+ * xc_evtchn_pending().
+ */
+int xc_evtchn_fd(int xce_handle);
+
+/*
+ * Notify the given event channel. Returns -1 on failure, in which case
+ * errno will be set appropriately.
+ */
+int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
+
+/*
+ * Returns a new event port awaiting interdomain connection from the given
+ * domain ID, or -1 on failure, in which case errno will be set appropriately.
+ */
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid);
+
+/*
+ * Returns a new event port bound to the remote port for the given domain ID,
+ * or -1 on failure, in which case errno will be set appropriately.
+ */
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+                           evtchn_port_t remote_port);
+
+/*
+ * Bind an event channel to the given VIRQ. Returns the event channel bound to
+ * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
+ */
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
+
+/*
+ * Unbind the given event channel. Returns -1 on failure, in which case errno
+ * will be set appropriately.
+ */
+int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
+
+/*
+ * Return the next event channel to become pending, or -1 on failure, in which
+ * case errno will be set appropriately.  
+ */
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle);
+
+/*
+ * Unmask the given event channel. Returns -1 on failure, in which case errno
+ * will be set appropriately.
+ */
+int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
+
 int xc_physdev_pci_access_modify(int xc_handle,
                                  uint32_t domid,
                                  int bus,
@@ -699,66 +767,6 @@ int xc_version(int xc_handle, int cmd, void *arg);
 
 int xc_acm_op(int xc_handle, int cmd, void *arg, unsigned long arg_size);
 
-/*
- * Return a handle to the event channel driver, or -1 on failure, in which case
- * errno will be set appropriately.
- */
-int xc_evtchn_open(void);
-
-/*
- * Close a handle previously allocated with xc_evtchn_open().
- */
-int xc_evtchn_close(int xce_handle);
-
-/*
- * Return an fd that can be select()ed on for further calls to
- * xc_evtchn_pending().
- */
-int xc_evtchn_fd(int xce_handle);
-
-/*
- * Notify the given event channel. Returns -1 on failure, in which case
- * errno will be set appropriately.
- */
-int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
-
-/*
- * Returns a new event port awaiting interdomain connection from the given
- * domain ID, or -1 on failure, in which case errno will be set appropriately.
- */
-evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid);
-
-/*
- * Returns a new event port bound to the remote port for the given domain ID,
- * or -1 on failure, in which case errno will be set appropriately.
- */
-evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
-    evtchn_port_t remote_port);
-
-/*
- * Unbind the given event channel. Returns -1 on failure, in which case errno
- * will be set appropriately.
- */
-int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
-
-/*
- * Bind an event channel to the given VIRQ. Returns the event channel bound to
- * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
- */
-evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
-
-/*
- * Return the next event channel to become pending, or -1 on failure, in which
- * case errno will be set appropriately.  
- */
-evtchn_port_t xc_evtchn_pending(int xce_handle);
-
-/*
- * Unmask the given event channel. Returns -1 on failure, in which case errno
- * will be set appropriately.
- */
-int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
-
 /**************************
  * GRANT TABLE OPERATIONS *
  **************************/